package qsou.rpc.framework.config;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * @description:
 * @auther: wuxw
 * @Date: 2022/3/29 16:01
 */
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Builder
@ToString
public class RpcServiceConfig {
  /**
   * service version
   */
  private String version ="";
  /**
   * when the interface has multiple implementation classes, distinguish by group
   */
  private String group = "";
  /**
   * target service
   */
  private Object service;
  public String getRpcServiceName(){
    return this.getService() + this.getGroup() + this.getVersion();
  }

  public String getServiceName(){
    return this.service.getClass().getInterfaces()[0].getCanonicalName();
  }

}